<template>
    <div class="big-box">
        <div class="header">
            <img src="../../../../../assets/bigScreen/header3.png" alt="" />
            <div class="backBox" @click="goBack"></div>
        </div>
        <div class="backToBox">
            <div class="backTo" @click="gotoHome">
                <div>返回总窗口</div>
            </div>
            <div class="backTo" @click="backToOne">
                <div>返回上一页</div>
            </div>
        </div>
        <div class="centerBox">
            <div class="sreenTitle">服务机构</div>
            <div class="center">
                <!-- 筛选区 -->
                <div class="filter-box">
                    <div class="filter-title-box">
                        <div class="filter-title">筛选条件</div>
                        <div class="filter-input-box">
                            <div class="filter-input">
                                <input type="text" placeholder="请输入关键词" v-model="dataMap.name" @keydown="onkeydown" />
                            </div>
                            <div class="filter-btn" @click="search">搜索企业</div>
                        </div>
                    </div>
                    <div class="filter-container">
                        <div class="filter-type" v-for="(item, index) in typeList" :style="{ height: item.showMore ? 'initial' : '55px' }">
                            <div class="filter-type-title">{{ item.title }}</div>
                            <div :class="['filter-item', typeIds[index] == null ? 'active' : '']" @click="setType(index, null,'')">
                                全部
                            </div>
                            <div v-for="sItem in item.list" :class="['filter-item', typeIds[index] == sItem.id ? 'active' : '']" :key="sItem.id"
                                @click="setType(index, sItem.id,sItem.name)">
                                {{ sItem.name }}
                            </div>
                            <div class="filter-more-btn" @click="item.showMore = !item.showMore">
                                <span>更多分类</span>
                                <img :style="{ transform: item.showMore ? 'scaleY(-1)' : 'scaleY(1)' }" src="../../../../../assets/down.png" alt="" />
                            </div>
                        </div>
                    </div>
                </div>
                <div class="org-container">
                    <div class="org-box" v-for="item in orgLIst">
                        <div class="org-title">{{ item.name }}</div>
                        <div class="org-img">
                            <img :src="baseUrl+item.image" alt="" />
                        </div>
                        <div class="org-sub-title">中心简介</div>
                        <div class="org-text two-lines" style="-webkit-line-clamp: 5" v-html=" item.content">
                        </div>
                        <div class="org-btn" @click="jump('/bigScreen/orgprojectDetails?id='+item.id)">了解详情</div>
                    </div>
                    <no-data v-if="!orgLIst.length" />
                </div>
                <div class="pagination-box">
                    <a-pagination :showSizeChanger='false' v-model:current="pages.number" v-model:pageSize="pages.size" :total="pages.total"
                        @change="onShowSizeChange" />
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import noData from '../../../no-data.vue'
import {
    ref,
    reactive,
    onBeforeMount
} from "vue";
import headerBox from "../../../../../components/header.vue";
import headerImg from "../../../../../components/headerImg.vue";
import footerBox from "../../../../../components/footer-box.vue";
import {
    propertyRightList
} from "../../../../../api/intellectualPropertyRight";
import {
    useRouter,
    useRoute
} from "vue-router";
import {
    basOrg
} from "../../../../../api/orgService";
import { baseUrl } from '../../../../../../config';
const router = useRouter();
const route = useRoute;
const jump = (url) => {
    router.push(url);
};
const dataMap = reactive({
    name: '',
    agencyType: '',
    industryCategory: '',
})

function search() {

    pages.number = 1
    getbasOrg();
}

function onkeydown(e) {
    if (e.key == 'Enter') {
        getbasOrg();
    }
}

function setType(index, type, name) {
    typeIds.value[index] = type;
    if (index == 0) {
        dataMap.agencyType = name
    } else {
        dataMap.industryCategory = name
    }
    pages.number=1
    getbasOrg();
}
const current = ref(6);
const tabIndex = ref(1);
const typeIds = ref([null, null, null, null, null, null, null, null, null]);
const orgLIst = ref({});
const typeList = ref([{
    title: "机构类目",
    showMore: false,
    list: [{
        name: "专业服务机构",
        id: 1,
    },
        // {
        // 	name: "技术创新中心",
        // 	id: 2,
        // },
        // {
        // 	name: "高新技术企业",
        // 	id: 3,
        // },
    ],
},
{
    title: "行业类目",
    showMore: false,
    list: [

        {
            name: "科学研究和技术服务",
            id: 1,
        }, {
            name: "科技推广和应用服务业",
            id: 2,
        }, {
            name: "商务服务业",
            id: 3,
        }, {
            name: "法律服务",
            id: 4,
        }, {
            name: "软件和信息技术服务业",
            id: 5,
        }, {
            name: "农副食品加工业",
            id: 6,
        }, {
            name: "其他未列明服务业",
            id: 7,
        },
        // {
        // 	name: "电子信息产业",
        // 	id: 1,
        // },
        // {
        // 	name: "航工行天产业",
        // 	id: 2,
        // },
        // {
        // 	name: "绿色农畜产业",
        // 	id: 3,
        // },
        // {
        // 	name: "生物医药产业",
        // 	id: 4,
        // },
        // {
        // 	name: "智慧社区产业",
        // 	id: 5,
        // },
    ],
},
]);
onBeforeMount(() => {
    console.log(route.query);
    // if (localStorage.getItem("token")) {
    //   router.replace("/home")
    //   return
    // }
    handleGetList();
    getbasOrg();
});

async function getbasOrg() {
    await basOrg({
        agencyType: dataMap.agencyType,
        industryCategory: dataMap.industryCategory,
        name: dataMap.name,
        ...pages
    }).then((res) => {
        console.log(res);
        orgLIst.value = res.data.list;
        pages.total = res.data.total

    });
}
async function handleGetList() {
    await propertyRightList({
        serviceType: 1
    }).then((res) => {
        console.log(res);
    });
}
const pages = reactive({
    number: 1, //第几页
    size: 8, //每页中显示数据的条数
    total: 0
})
const onShowSizeChange = (current, pageSize) => {
    pages.number = current
    pages.size = pageSize
    getbasOrg()
    console.log(current, pageSize);
};
    const gotoHome = (act) => {
    router.push({
        path: '/bigScreenIndex',
    })
}
const backToOne = (act) => {
    router.go(-1)
}

const goBack = () => {
    router.push('/chart')
}
</script>

<style scoped lang="scss">
@font-face {
    font-family: "ffa";
    src: url(../../../assets/bigScreen/fonts/DS-DIGIB.TTF);
}
ul,
li {
    list-style: none;
}
.big-box {
    background-color: #071c3b;
    height: 100vh;
}
.header {
    position: relative;
    text-align: center;
    position: relative;
    height: 19.1rem;

    .backBox {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 70rem;
        height: 10rem;
        cursor: pointer;
    }

    > img {
        width: 100%;
        max-height: 100%;
        margin-top: -1.1rem;
        image-rendering: -moz-crisp-edges; /* Firefox */
        image-rendering: -o-crisp-edges; /* Opera */
        image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming) */
        image-rendering: crisp-edges;
        -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */
    }
}
.centerBox {
    width: 96%;
    margin: 0 auto;
    position: absolute;
    top: 14rem;
    left: 2%;
    .sreenTitle {
        background-image: url("../../../../../assets/bigScreen/sreenTitle.png");
        background-size: 100% 100%;
        height: 3.8rem;
        padding-left: 35px;
        font-weight: 600;
        color: #fff;
        display: flex;
        align-items: center;
    }
    .center {
        margin-top: 1rem;
        height: calc(100vh - 20rem);
        border: 1px solid;
        border-image: linear-gradient(
                130deg,
                #2385df 0%,
                rgba(35, 133, 223, 0.65) 92%
            )
            1;
        overflow-y: scroll;
        padding: 20px;

        .filter-box {
            width: 136rem;
            margin: 0 auto;
            margin-bottom: 20px;
            padding: 20px 40px;
            // background-color: #ffffff;
        }

        .filter-title-box {
            width: 100%;
            height: 60px;
            border-bottom: 1px solid #4494FF46;
        }

        .filter-title {
            line-height: 40px;
            float: left;
            font-size: 18px;
            font-weight: bold;
            color: #037aff;
        }

        .filter-input-box {
            width: 500px;
            height: 40px;
            float: right;
        }

        .filter-input {
            width: 380px;
            height: 40px;
            padding: 4px 20px;
            float: left;
            border-top: 1px solid #4494FF46;
            border-left: 1px solid #4494FF46;
            border-bottom: 1px solid #4494FF46;
        }

        .filter-input input {
            width: 340px;
            height: 30px;
            border: none;
            outline: none;
            background-color: transparent;
            color: #ffffff;
        }

        .filter-btn {
            width: 120px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            background: #037aff;
            border-top-right-radius: 4px;
            border-bottom-right-radius: 4px;
            float: left;
            font-size: 15px;
            color: #ffffff;
            cursor: pointer;
        }

        .filter-container {
            width: 100%;
            padding-top: 20px;
        }

        .filter-type {
            height: 55px;
            position: relative;
            padding-right: 90px;
            overflow: hidden;
            display: flex;
            flex-wrap: wrap;
        }

        .filter-more-btn {
            position: absolute;
            right: 0;
            top: 0;
            cursor: pointer;
            display: flex;
            align-items: center;
        }

        .filter-more-btn span {
            font-size: 16px;
            color: #037aff;
        }

        .filter-more-btn img {
            width: 10px;
            height: 5px;
            margin-left: 8px;
            margin-top: 8px;
        }

        .filter-type.last .filter-item {
            margin-bottom: 0;
        }

        .filter-type-title {
            display: inline-block;
            width: 9rem;
            margin-right: 40px;
            font-size: 17px;
            font-weight: bold;
            color: #fff;
        }

        .filter-item {
            display: inline-block;
            margin-bottom: 30px;
            padding: 0 15px;
            height: 25px;
            line-height: 25px;
            border-radius: 4px;
            font-size: 16px;
            color: #fff;
            cursor: pointer;
        }

        .filter-item.active {
            background-color: #037aff;
            color: #fff;
        }

        .org-container {
            width: 136rem;
            height: max-content;
            margin: 3rem auto;
            display: flex;
            flex-wrap: wrap;

            .org-box {
                width: calc(25% - 1.15rem);
                height: 52rem;
                margin-right: 1.5rem;
                margin-bottom: 1.5rem;
                background: #082853;
            border: 1px solid #4494FF46;
                padding: 1rem;

                &:nth-child(4n + 4) {
                    margin-right: 0;
                }

                .org-title {
                    word-break: keep-all;
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    text-align: center;
                    font-size: 2rem;
                    line-height: 6.8rem;
                    color: rgba(255, 255, 255, 0.85);
                    font-weight: bold;
                    position: relative;
                    overflow: hidden;

                    &::after {
                        content: "";
                        position: absolute;
                        left: 0;
                        top: 0;
                        width: 100%;
                        height: 6px;
                        background: linear-gradient(
                            89deg,
                            #037dff 0%,
                            #00b578 100%
                        );
                    }
                }

                .org-img {
                    width: 100%;
                    height: 19rem;
                    // background-color: #4494FF46;

                    img {
                        width: 100%;
                        height: 100%;
                        object-fit: cover;
                    }
                }

                .org-sub-title {
                    margin-top: 1.5rem;
                    margin-bottom: 1rem;
                    font-size: 1.8rem;
                    font-weight: bold;
                    text-overflow: ellipsis;
                    color: #fff;

                    display: -webkit-box;
                    -webkit-line-clamp: 2;
                    -webkit-box-orient: vertical;

                    display: -moz-box;
                    -moz-line-clamp: 2;
                    -moz-box-orient: vertical;

                    overflow-wrap: break-word;
                    word-break: break-all;
                    white-space: normal;
                    overflow: hidden;
                }

                .org-text {
                    font-size: 1.6rem;
                    line-height: 2.5rem;
                    height: 12.5rem;
                    color: rgba(255, 255, 255, 0.6);
                    text-overflow: ellipsis;

                    display: -webkit-box;
                    -webkit-line-clamp: 2;
                    -webkit-box-orient: vertical;

                    display: -moz-box;
                    -moz-line-clamp: 2;
                    -moz-box-orient: vertical;

                    overflow-wrap: break-word;
                    word-break: break-all;
                    white-space: normal;
                    overflow: hidden;
                }

                .org-btn {
                    width: 100%;
                    height: 3.4rem;
                    margin-top: 2rem;
                    line-height: 3.4rem;
                    text-align: center;
                    border-radius: 4px;
                    background: #037dff;
                    font-size: 1.4rem;
                    color: #ffffff;
                    cursor: pointer;
                }
            }
        }

        .pagination-box {
            width: 100%;
            height: 10rem;
            display: flex;
            align-items: center;
            justify-content: center;
        }
    }
    ::-webkit-scrollbar {
        width: 5px;
        height: 10px;
    }

    /* 滚动条轨道 */
    ::-webkit-scrollbar-track {
        background-color: #234470;
    }

    /* 滚动条滑块 */
    ::-webkit-scrollbar-thumb {
        background-color: #061c57;
    }

    /* 鼠标悬停在滚动条上的滑块 */
    ::-webkit-scrollbar-thumb:hover {
        background-color: #555;
    }
}
.backToBox {
    position: absolute;
    top: 8rem;
    right: 2%;
    display: flex;
    .backTo {
        background-image: url("../../../../../assets/bigScreen/backTo.png");
        color: #2dccff;
        background-size: 100% 100%;
        width: fit-content;
        padding: 2px 40px 10px 10px;
        font-weight: 600;
        cursor: pointer;
        margin-left: 10px;
        div {
            padding-top: 5px;
        }
    }
}::v-deep {
    .ant-btn-primary {
        border-color: #037aff;
        background: #037aff;
    }

    .ant-input {
        background: rgba(68, 148, 255, 0.12);
        border: none;
        color: #ffffff;
    }

    .ant-pagination-item {
        background: rgba(8, 26, 48, 0.8);
        border: 1px solid #0b2f5f;
    }

    .ant-pagination-item a {
        color: #ffffff;
    }

    .ant-pagination-prev .ant-pagination-item-link,
    .ant-pagination-next .ant-pagination-item-link {
        background: rgba(8, 26, 48, 0.8);
        border: 1px solid #0b2f5f;
        color: #707981;
    }

    .ant-pagination-disabled .ant-pagination-item-link {
        background: rgba(8, 26, 48, 0.8);
        border: 1px solid #0b2f5f;
        color: #707981;
    }

    .ant-pagination-item-active {
        background: #004dfd;
        border-radius: 2px;
        border: none;
    }

    .ant-pagination-jump-prev
        .ant-pagination-item-container
        .ant-pagination-item-ellipsis,
    .ant-pagination-jump-next
        .ant-pagination-item-container
        .ant-pagination-item-ellipsis {
        color: #ffffff;
    }
    .ant-select-selector {
        background-color: transparent !important;
        background: rgba(8, 26, 48, 0.8) !important;
        border: 1px solid #0b2f5f !important;
        color: #ffffff !important;
    }
}
</style>
